<template>
	<view>
		<!--<z-nav-bar>选班</z-nav-bar>-->
		<!-- 公共组件-每个页面必须引入 -->
		<!--<public-module></public-module>-->
		<Calendar :startDate="startDate" :endDate="endDate" :selected="selected" :limitFlag="false"
			:selectedDate="selectedDate" @change="calendarChange" />
	</view>
</template>

<script>
	import Calendar from '@/components/heqifang-calendar/calendar.vue'
	export default {
		components: {
			Calendar
		},
		data() {
			return {
				isExpand: true,
				startDate: '2020-04-05', //上课开始有效日期
				endDate: '2021-12-05', //上课结束有效日期
				selectedDate: [],
				selected: [{
						date: '2021-04-08',
						info: '有课',
						data: {
							custom: '',
							name: ''
						}
					},
					{
						date: '2021-04-10',
						info: '有课',
						data: {
							custom: '',
							name: ''
						}
					},
					{
						date: '2021-06-23',
						info: '有课',
						data: {
							custom: '',
							name: ''
						}
					},
					{
						date: '2021-06-28',
						info: '有课',
						data: {
							custom: '',
							name: ''
						}
					},
				]
			};
		},
		onLoad(e) {

		},
		onShow() {

		},
		//方法
		methods: {
			onPageJump(url) {
				uni.navigateTo({
					url: url
				});
			},
			calendarChange(e) {
				console.log(e);
				// 当前选择时间
				let _date = e.fulldate;
				// 判断这个时间是否已选中
				let _index = this.selectedDate.indexOf(_date);
				this.selectedDate = [_date]
				if (e.extraInfo.info) {
					uni.navigateTo({
						url: `/subpages/my/course?date=${e.extraInfo.date}`
					});
				}
			}
		},
		//页面下来刷新
		onPullDownRefresh() {},
		//页面上拉触底
		onReachBottom() {},
		//用户点击分享
		onShareAppMessage(e) {
			return this.wxShare();
		}
	};
</script>
<style lang="scss" scoped>
</style>
